package logic

import (
	"context"
	"nate_srv/nate"

	"api/internal/svc"
	"api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type NateInfoLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewNateInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NateInfoLogic {
	return &NateInfoLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *NateInfoLogic) NateInfo(req *types.NateInfoRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	info, err := l.svcCtx.NateSrv.NateInfo(l.ctx, &nate.NateInfoRequest{
		NateId: req.NateId,
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    500,
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Message: "但笔记详情查询成功",
		Code:    200,
		Data:    info,
	}, nil
}
